home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 41.zip / BS1 part 41 / Devpac 2.12 disk 2.adf / include.cbm / devices / trackdisk.i < prev   
Text File  |  1987-03-31  |  7KB  |  194 lines

  1.  
  2. *************************************************************************
  3. *                                                                       *
  4. *       Copyright (C) 1985, Commodore Amiga Inc.  All rights reserved.  *
  5. *                                                                       *
  6. *************************************************************************
  7.  
  8.  
  9. *************************************************************************
  10. *
  11. * trackdisk.i
  12. *
  13. * Source Control
  14. * ------ -------
  15. * $Header: trackdisk.i,v 33.3 86/04/10 00:57:43 neil Exp $
  16. *
  17. * $Locker:  $
  18. *
  19. *************************************************************************
  20.  
  21.         IFND    DEVICES_TRACKDISK_I
  22. DEVICES_TRACKDISK_I     SET     1
  23.  
  24.         IFND    EXEC_IO_I
  25.         INCLUDE "exec/io.i"
  26.         ENDC    !EXEC_IO_I
  27.  
  28.         IFND    EXEC_DEVICES_I
  29.         INCLUDE "exec/devices.i"
  30.         ENDC    !EXEC_DEVICES_I
  31.  
  32. *--------------------------------------------------------------------
  33. *
  34. * Physical drive constants
  35. *
  36. *--------------------------------------------------------------------
  37.  
  38.  
  39. * OBSOLETE -- only valid for 3 1/4" drives.  Use the TD_GETNUMTRACKS command!
  40. *
  41. *NUMCYLS                EQU     80              ; normal # of cylinders
  42. *MAXCYLS                EQU     NUMCYLS+20      ; max # of cyls to look for
  43. *                                               ;       during a calibrate
  44. *NUMHEADS       EQU     2
  45. *NUMTRACKS      EQU     NUMCYLS*NUMHEADS
  46.  
  47. NUMSECS         EQU     11
  48. NUMUNITS        EQU     4
  49.  
  50. *--------------------------------------------------------------------
  51. *
  52. * Useful constants
  53. *
  54. *--------------------------------------------------------------------
  55.  
  56.  
  57. *-- sizes before mfm encoding
  58. TD_SECTOR       EQU     512
  59. TD_SECSHIFT     EQU     9                       ; log TD_SECTOR
  60. *                                               ;    2
  61.  
  62.  
  63. *--------------------------------------------------------------------
  64. *
  65. * Driver Specific Commands
  66. *
  67. *--------------------------------------------------------------------
  68.  
  69. *-- TD_NAME is a generic macro to get the name of the driver.  This
  70. *-- way if the name is ever changed you will pick up the change
  71. *-- automatically.
  72. *--
  73. *-- Normal usage would be:
  74. *--
  75. *-- internalName:       TD_NAME
  76. *--
  77.  
  78. TD_NAME:        MACRO
  79.                 DC.B    'trackdisk.device',0
  80.                 DS.W    0
  81.                 ENDM
  82.  
  83.         BITDEF  TD,EXTCOM,15
  84.  
  85.         DEVINIT
  86.         DEVCMD  TD_MOTOR                ; control the disk's motor
  87.         DEVCMD  TD_SEEK                 ; explicit seek (for testing)
  88.         DEVCMD  TD_FORMAT               ; format disk
  89.         DEVCMD  TD_REMOVE               ; notify when disk changes
  90.         DEVCMD  TD_CHANGENUM            ; number of disk changes
  91.         DEVCMD  TD_CHANGESTATE          ; is there a disk in the drive?
  92.         DEVCMD  TD_PROTSTATUS           ; is the disk write protected?
  93.         DEVCMD  TD_RAWREAD              ; read raw bits from the disk
  94.         DEVCMD  TD_RAWWRITE             ; write raw bits to the disk
  95.         DEVCMD  TD_GETDRIVETYPE         ; get the type of the disk drive
  96.         DEVCMD  TD_GETNUMTRACKS         ; get the # of tracks on this disk
  97.         DEVCMD  TD_ADDCHANGEINT         ; TD_REMOVE done right
  98.         DEVCMD  TD_REMCHANGEINT         ; removes softint set by ADDCHANGEINT
  99.         DEVCMD  TD_LASTCOMM             ; dummy placeholder for end of list
  100.  
  101.  
  102. *
  103. *
  104. * The disk driver has an "extended command" facility.  These commands
  105. * take a superset of the normal IO Request block.
  106. *
  107. ETD_WRITE       EQU     (CMD_WRITE!TDF_EXTCOM)
  108. ETD_READ        EQU     (CMD_READ!TDF_EXTCOM)
  109. ETD_MOTOR       EQU     (TD_MOTOR!TDF_EXTCOM)
  110. ETD_SEEK        EQU     (TD_SEEK!TDF_EXTCOM)
  111. ETD_FORMAT      EQU     (TD_FORMAT!TDF_EXTCOM)
  112. ETD_UPDATE      EQU     (CMD_UPDATE!TDF_EXTCOM)
  113. ETD_CLEAR       EQU     (CMD_CLEAR!TDF_EXTCOM)
  114. ETD_RAWREAD     EQU     (TD_RAWREAD!TDF_EXTCOM)
  115. ETD_RAWWRITE    EQU     (TD_RAWWRITE!TDF_EXTCOM)
  116.  
  117.  
  118. *
  119. * extended IO has a larger than normal io request block.
  120. *
  121.  
  122.  STRUCTURE IOEXTTD,IOSTD_SIZE
  123.         ULONG   IOTD_COUNT      ; removal/insertion count
  124.         ULONG   IOTD_SECLABEL   ; sector label data region
  125.         LABEL   IOTD_SIZE
  126.  
  127. *
  128. * raw read and write can be synced with the index pulse.  This flag
  129. * in io request's IO_FLAGS field tells the driver that you want this.
  130. *
  131.         BITDEF  IOTD,INDEXSYNC,4
  132.  
  133. * labels are TD_LABELSIZE bytes per sector
  134.  
  135. TD_LABELSIZE    EQU     16
  136.  
  137. *
  138. * This is a bit in the FLAGS field of OpenDevice.  If it is set, then
  139. * the driver will allow you to open all the disks that the trackdisk
  140. * driver understands.  Otherwise only 3.5" disks will succeed.
  141. *
  142. *
  143.         BITDEF  TD,ALLOW_NON_3_5,0
  144.  
  145. *
  146. *  If you set the TDB_ALLOW_NON_3_5 bit in OpenDevice, then you don't
  147. *  know what type of disk you really got.  These defines are for the
  148. *  TD_GETDRIVETYPE command.  In addition, you can find out how many
  149. *  tracks are supported via the TD_GETNUMTRACKS command.
  150. *
  151. DRIVE3_5        EQU     1
  152. DRIVE5_25       EQU     2
  153.  
  154. *--------------------------------------------------------------------
  155. *
  156. * Driver error defines
  157. *
  158. *--------------------------------------------------------------------
  159.  
  160. TDERR_NotSpecified      EQU     20      ; general catchall
  161. TDERR_NoSecHdr          EQU     21      ; couldn't even find a sector
  162. TDERR_BadSecPreamble    EQU     22      ; sector looked wrong
  163. TDERR_BadSecID          EQU     23      ; ditto
  164. TDERR_BadHdrSum         EQU     24      ; header had incorrect checksum
  165. TDERR_BadSecSum         EQU     25      ; data had incorrect checksum
  166. TDERR_TooFewSecs        EQU     26      ; couldn't find enough sectors
  167. TDERR_BadSecHdr         EQU     27      ; another "sector looked wrong"
  168. TDERR_WriteProt         EQU     28      ; can't write to a protected disk
  169. TDERR_DiskChanged       EQU     29      ; no disk in the drive
  170. TDERR_SeekError         EQU     30      ; couldn't find track 0
  171. TDERR_NoMem             EQU     31      ; ran out of memory
  172. TDERR_BadUnitNum        EQU     32      ; asked for a unit > NUMUNITS
  173. TDERR_BadDriveType      EQU     33      ; not a drive that trackdisk groks
  174. TDERR_DriveInUse        EQU     34      ; someone else allocated the drive
  175. TDERR_PostReset         EQU     35      ; user hit reset; awaiting doom
  176.  
  177. *--------------------------------------------------------------------
  178. *
  179. * Public portion of unit structure
  180. *
  181. *--------------------------------------------------------------------
  182.  
  183.  STRUCTURE TDU_PUBLICUNIT,UNIT_SIZE
  184.         UWORD   TDU_COMP01TRACK         ; track for first precomp
  185.         UWORD   TDU_COMP10TRACK         ; track for second precomp
  186.         UWORD   TDU_COMP11TRACK         ; track for third precomp
  187.         ULONG   TDU_STEPDELAY           ; time to wait after stepping
  188.         ULONG   TDU_SETTLEDELAY         ; time to wait after seeking
  189.         UBYTE   TDU_RETRYCNT            ; # of times to retry
  190.         LABEL   TDU_PUBLICUNITSIZE
  191.  
  192.         ENDC    DEVICE_TRACKDISK_I
  193.